using System;
using System.Collections.Generic;
using System.Text;
using FlatRedBall;
using FlatRedBall.Input;
using FlatRedBall.Graphics;
using FlatRedBall.AI.Pathfinding;
using FlatRedBall.Graphics.Animation;
using FlatRedBall.Graphics.Particle;

using FlatRedBall.Graphics.Model;
using FlatRedBall.Math.Geometry;
using FlatRedBall.Math.Splines;
using Cursor = FlatRedBall.Gui.Cursor;
using GuiManager = FlatRedBall.Gui.GuiManager;
using Microsoft.Xna.Framework.Input;

#if FRB_XNA || SILVERLIGHT
using Keys = Microsoft.Xna.Framework.Input.Keys;
using Vector3 = Microsoft.Xna.Framework.Vector3;
using Texture2D = Microsoft.Xna.Framework.Graphics.Texture2D;
using Gnome.Engine;
#endif

namespace Gnome.Screens
{
    public partial class Credits
    {
        //for transitions
        const float TIME_FOR_TRANSITIONS = 0.67f;
        bool transition;
        float transitionTimeSoFar;
        bool transitionIn;
        float transitionInTimeSoFar;


        public void CustomInitialize()
        {

		}

		public void CustomActivity(bool firstTimeCalled)
		{
            if (transitionIn)
            {
                transitionInTimeSoFar += TimeManager.SecondDifference;
                float percentLeft = transitionInTimeSoFar / TIME_FOR_TRANSITIONS;
                MainImageBackground.Alpha = percentLeft;

                if (transitionInTimeSoFar > TIME_FOR_TRANSITIONS)
                {
                    transitionIn = false;
                }
            }

            if (transition)
            {
                transitionTimeSoFar += TimeManager.SecondDifference;

                float percentLeft = 1 - transitionTimeSoFar / TIME_FOR_TRANSITIONS;
                MainImageBackground.Alpha = percentLeft;

                if (transitionTimeSoFar > TIME_FOR_TRANSITIONS)
                {
                    transition = false;
                    IsActivityFinished = true;
                    MoveToScreen(typeof(Gnome.Screens.MainMenu).FullName);
                }
            }
            else
            {
                if (CustomInputManager.isMenuCancel() || CustomInputManager.isMenuSelect())
                {
                    transition = true;
                }
            }
        }

        public void CustomDestroy()
        {

            SpriteManager.RemoveSprite(MainImageBackground);
        }

        private static void CustomLoadStaticContent(string contentManagerName)
        {


        }

    }
}